package com.ctcemti.mdm.project.sys.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.alibaba.fastjson.annotation.JSONField;
import com.ctcemti.mdm.project.sys.entity.formdata.BaseReq;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.util.Date;

@ApiModel("项目ebs类")
public class ResEntElementTree extends BaseReq implements IExcelModel,IExcelDataModel,Comparable<ResEntElementTree>{
    /**
     * 主键id
     */
    @Id
    @ApiModelProperty(value = "主键id", required = true)
    private Integer id;

    @ApiModelProperty(value = "名称")
    @Excel(name = "构件名称")
    private String name;

    @ApiModelProperty(value = "类型")
    @Excel(name = "构件类型")
    private String type;

    @ApiModelProperty(value = "父级id")
    private String parentId;


    @ApiModelProperty(value = "父级id")
    @Transient
    private String parentName;
    @Excel(name = "层级")
    @ApiModelProperty(value = "级别")

    private Integer hierarchy;

    @ApiModelProperty(value = "ebs编码")
    @Excel(name = "构件编码")
    @NotNull(message = "分类不能为空" )
    private String ebs;

    @ApiModelProperty(value = "单位")
    @Excel(name = "单位")
    private String unit;

    @Excel(name = "IFD编码")
    @ApiModelProperty(value = "Ifd编码")
    private String ifd;

    @ApiModelProperty(value = "是否关联工法")
    private Integer relMethods;

    @ApiModelProperty(value = "备注")
    private String comment;

    @ApiModelProperty(value = "创建人")
    private String creator;

    @ApiModelProperty(value = "创建时间")
    private Date createDate;

    @ApiModelProperty(value = "修改人")
    private String modifiedBy;

    @ApiModelProperty(value = "修改时间")
    private Date modifyDate;

    @ApiModelProperty(value = "归属领域")
    private String disciplinesId;

    @Transient
    private String uuid;

    @Transient
    private boolean state = false;

    /**
     * 辅助字段
     */
    @Transient
    private boolean haveChild = true;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    @Transient
    @JSONField(name = "_parentId")
    private String _parentId;

    @Transient
    @Excel(name = "错误提示")
    @ApiModelProperty(hidden = true)//swagger忽略属性
    private String errorMsg;

    @Transient
    @ApiModelProperty(hidden = true)//swagger忽略属性
    private int rowNum;

    public Integer getId() {
        return id;
    }

    public String getDisciplinesId() {
        return disciplinesId;
    }

    public void setDisciplinesId(String disciplinesId) {
        this.disciplinesId = disciplinesId;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getParentId() {

        return parentId;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public int getRowNum() {
        return rowNum;
    }

    public void setRowNum(int rowNum) {
        this.rowNum = rowNum;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public void setParentId(String parentId) {
        this._parentId = parentId + "";
        this.parentId = parentId;
    }

    public Integer getHierarchy() {
        return hierarchy;
    }

    public void setHierarchy(Integer hierarchy) {
        this.hierarchy = hierarchy;
    }

    public String getEbs() {
        return ebs;
    }

    public void setEbs(String ebs) {
        this.ebs = ebs.trim();
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getIfd() {
        return ifd;
    }

    public void setIfd(String ifd) {
        this.ifd = ifd.trim();
    }

    public Integer getRelMethods() {
        return relMethods;
    }

    public void setRelMethods(Integer relMethods) {
        this.relMethods = relMethods;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getModifiedBy() {
        return modifiedBy;
    }

    public void setModifiedBy(String modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    public Date getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }

    public boolean getState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    public String get_parentId() {
        return _parentId;
    }

    public boolean isHaveChild() {
        return haveChild;
    }

    public void setHaveChild(boolean haveChild) {
        this.haveChild = haveChild;
    }

    public void set_parentId(String _parentId) {
        this._parentId = _parentId;
    }

    @Override
    public String toString() {
        return "ResEntElementTree{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", parentId=" + parentId +
                ", hierarchy=" + hierarchy +
                ", ebs='" + ebs + '\'' +
                ", unit='" + unit + '\'' +
                ", ifd='" + ifd + '\'' +
                ", relMethods=" + relMethods +
                ", comment='" + comment + '\'' +
                ", creator='" + creator + '\'' +
                ", createDate=" + createDate +
                ", modifiedBy='" + modifiedBy + '\'' +
                ", modifyDate=" + modifyDate +
                ", state='" + state + '\'' +
                ", _parentId='" + _parentId + '\'' +
                '}';
    }




    @Override
    public int compareTo(ResEntElementTree resMethods) {           //重写Comparable接口的compareTo方法，
        return this.rowNum - resMethods.getRowNum();// 根据行号升序排列，降序修改相减顺序即可
    }


}
